﻿<UserControl x:Class="Twilight.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:tc="clr-namespace:Twilight.Controls"
    >
    <UserControl.Resources>
        <Style x:Key="ft" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Foreground" Value="#C64A3503"/>
            <Setter Property="FontSize" Value="12"/>
        </Style>
        <ControlTemplate x:Key='FeedItemTemplate' TargetType='ListBoxItem'>
            <Grid Background='Transparent' MinHeight='35' Margin="0,8,0,4">
                <Rectangle Stroke="#FF1A2943" StrokeThickness="1" RadiusX="2" RadiusY="2" Opacity="0.695" Fill="{StaticResource rb}"/>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <tc:TweetBlock Grid.Row="0" Text="{Binding text}" Margin="5,0,0,0" TextStyle="{StaticResource TweetText}" LinkStyle="{StaticResource TweetLink}" />
                    <tc:TweetInfo Grid.Row="1" PostDate="{Binding created_at}" From="{Binding source}" Margin="5,0,0,0" TextStyle="{StaticResource InfoText}" LinkStyle="{StaticResource InfoLink}"/>
                </Grid>
            </Grid>
        </ControlTemplate>
        <Style TargetType='ListBoxItem' x:Key='FeedItemContainerStyle'>
            <Setter Property='Template' Value='{StaticResource FeedItemTemplate}'/>
        </Style>
    </UserControl.Resources>
    <Border BorderThickness="1" BorderBrush="Black" CornerRadius="2">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="24" />
                <RowDefinition Height="*" />
                <RowDefinition Height="20" />
            </Grid.RowDefinitions>
            <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFB1CCFF"/>
                    <GradientStop Color="#FF3057A5" Offset="1"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Image HorizontalAlignment="Left" Grid.Row="0" Margin="2" Source="http://assets1.twitter.com/images/twitter_logo_s.png" Height="20" Stretch="Uniform" />
            <ListBox Grid.Row="1" x:Name="twitList" ItemContainerStyle='{StaticResource FeedItemContainerStyle}' Template="{StaticResource FeedListBox}" />
            <TextBlock Grid.Row="1" x:Name="loading" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Loading..." />
            <HyperlinkButton HorizontalAlignment="Right" Grid.Row="2" x:Name="followLink" Content="follow me on Twitter" Margin="5,0,19,0"/>
        </Grid>
    </Border>
</UserControl>
